package com.qf.cx.simplenms.core.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import com.qf.cx.simplenms.common.config.CommonConfig;
import com.qf.cx.simplenms.core.api.impl.BootsrapImpl;
import com.qf.cx.simplenms.core.spi.Updater;
import com.qf.cx.simplenms.core.spi.impl.ReaderGroupUpdater;
import com.qf.cx.simplenms.core.spi.impl.ReaderUpdater;
import com.qf.cx.simplenms.core.spi.impl.SubscriberUpdater;
import com.qf.cx.simplenms.core.spi.impl.TagMemoryUpdater;
import com.qf.cx.simplenms.core.spi.impl.TopicUpdater;
import com.qf.cx.simplenms.persist.config.PersistConfig;
import com.qf.cx.simplenms.reader.config.ReaderConfig;
import com.qf.cx.simplenms.readergroup.config.ReaderGroupConfig;
import com.qf.cx.simplenms.subscriber.config.SubscriberConfig;
import com.qf.cx.simplenms.tagmemory.config.TagMemoryConfig;
import com.qf.cx.simplenms.topic.config.TopicConfig;

@Configuration
@ComponentScan(basePackageClasses = { CommonConfig.class, CoreConfig.class, PersistConfig.class, SubscriberConfig.class, ReaderConfig.class,
        ReaderGroupConfig.class, TagMemoryConfig.class, TopicConfig.class })
public class CoreConfig {
	@Bean
	@Order(1)
	public Updater readerUpdater() {
		return new ReaderUpdater();
	}

	@Bean
	@Order(2)
	public Updater readerGroupUpdater() {
		return new ReaderGroupUpdater();
	}

	@Bean
	@Order(3)
	public Updater tagMemoryUpdater() {
		return new TagMemoryUpdater();
	}

	@Bean
	@Order(4)
	public Updater topicUpdater() {
		return new TopicUpdater();
	}

	@Bean
	@Order(5)
	public Updater subscriberUpdater() {
		return new SubscriberUpdater();
	}

	@Bean
	public BootsrapImpl bootsrapImpl() {
		return new BootsrapImpl(10);
	}
}
